package kr.or.kead.ui.meun;

import java.awt.event.ActionEvent;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

import kr.or.kead.service.DaoRequestCourse;
import kr.or.kead.ui.insert_update.DepartInsrtUpdate;
import kr.or.kead.ui.insert_update.RequestCourseInsetUpdate;
import kr.or.kead.ui.list.AbsTableList;
import kr.or.kead.ui.list.RequestCourseTableList;

public class RequestMenu extends AbsMeun {
	private DaoRequestCourse daoRequestCourse;
	private AbsTableList atl;
	
	public RequestMenu(JFrame frame, int height) {
		super(frame, "개설 강좌");
		daoRequestCourse= new DaoRequestCourse();
		atl = new RequestCourseTableList(height);
	}

	@Override
	protected void addMenuActionPerformed(ActionEvent e) {
		RequestCourseInsetUpdate insert= new RequestCourseInsetUpdate(null);
		insert.setVisible(true);
		if (insert.showDialog()==0)atl.setTableModel();

	}

	@Override
	protected void delMenuActionPerformed(ActionEvent e) {
		int res = searchNum(daoRequestCourse, "삭제",0);
		if (res !=-1 && daoRequestCourse.deleteDao(res) != -1){
			atl.setTableModel();
			JOptionPane.showMessageDialog(null, "삭제 되었습니다");
		}

	}

	@Override
	protected void updateMenuActionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	protected void listMenuActionPerformed(ActionEvent e) {
		refreshList(atl);

	}

}
